import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);

const routes = [
    {
        path: '/home',
        name: "home",
        component: (resolve) =>
            require(["../components/common/App.vue"], resolve),
        redirect: '/home/now',
        children: [
            {
                name: 'user',
                path: "user",
                component: () => import("../page/User.vue"),
            }, {
                name: 'report',
                path: "report",
                component: () => import("../page/Report.vue"),
            }, {
                name: 'now',
                path: "now",
                component: () => import("../page/Now.vue"),
            }, {
                name: 'adduser',
                path: "adduser",
                component: () => import("../page/AddUser.vue"),
            }
        ]

    },
    {
        path: "/login",
        name: 'login',
        component: () => import("../page/Login.vue"),
    },
    {
        path: "/register",
        name: 'register',
        component: () => import("../page/Register.vue"),

    },
    {
        path: "*",
        component: () => import("../page/404.vue"),
        name: '404',
        meta: { title: '页面错误' },
    }
];
const router = new VueRouter({
    mode: "hash",
    routes
});
export default router;